#include "fxcc/yml/Serializer.h"
#include "fxcc/core/graph/common/Params.h"

using namespace fxcc::yml;
using namespace fxcc::graph::common;

template<>
void Serializer::Encode<Params>(YAML::Node& node, const Params& inst)
{
    Encode<fxcc::Base>(node, inst);
    SetMapVariable<int>(node, "m_Ints", inst.m_Ints);
    SetMapVariable<float>(node, "m_Floats", inst.m_Floats);
    SetMapVariable<glm::vec2>(node, "m_Vec2s", inst.m_Vec2s);
    SetMapVariable<glm::vec3>(node, "m_Vec3s", inst.m_Vec3s);
    SetMapVariable<glm::vec4>(node, "m_Vec4s", inst.m_Vec4s);
    SetMapVariable<glm::ivec2>(node, "m_IVec2s", inst.m_IVec2s);
    SetMapVariable<glm::ivec3>(node, "m_IVec3s", inst.m_IVec3s);
    SetMapVariable<glm::ivec4>(node, "m_IVec4s", inst.m_IVec4s);
}


template<>
bool Serializer::Decode<Params>(const YAML::Node& node, Params& inst)
{
    Decode<fxcc::Base>(node, inst);
    GetMapVariable<int>(node, "m_Ints", inst.m_Ints);
    GetMapVariable<float>(node, "m_Floats", inst.m_Floats);
    GetMapVariable<glm::vec2>(node, "m_Vec2s", inst.m_Vec2s);
    GetMapVariable<glm::vec3>(node, "m_Vec3s", inst.m_Vec3s);
    GetMapVariable<glm::vec4>(node, "m_Vec4s", inst.m_Vec4s);
    GetMapVariable<glm::ivec2>(node, "m_IVec2s", inst.m_IVec2s);
    GetMapVariable<glm::ivec3>(node, "m_IVec3s", inst.m_IVec3s);
    GetMapVariable<glm::ivec4>(node, "m_IVec4s", inst.m_IVec4s);
    return true;
}